import { createApp } from "vue";
import "vant/lib/index.css";
import "./style.css";
import App from "./App.vue";
import { setupStore, useAppStore } from "./store";
import { setupRouter } from "./router/router.ts";
import VantUI from "vant";
import VConsole from "vconsole";
const vConsole = new VConsole();

async function bootstrap() {
  const app = createApp(App);
  app.use(VantUI);
  setupStore(app);
  setupRouter(app);
  uni.webView.getEnv(function (res: any) {
    console.log("当前环境：" + JSON.stringify(res));

    const appStore = useAppStore();
    appStore.setClient(res.plus ? "plus" : "h5");

    app.mount("#app");
  });
}

document.addEventListener("UniAppJSBridgeReady", () => {
  bootstrap().then(() => {
    console.log("欢迎使用");
  });
});
